package day7;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class JavaTestClass {
    public static void main(String[] args) {
        System.out.println("新班开班");
        Scanner in = new Scanner(System.in);
        JavaClass jc = new JavaClass();
        System.out.print("请输入班级名：");
        jc.name = in.next();
        System.out.print("请输入老师：");
        jc.teacher = in.next();
        System.out.print("请输入班主任：");
        jc.dirTeacher = in.next();
        System.out.print("请输入开班时间：");
        jc.start = in.next();
        int choice = 0;
        while (true) {
            System.out.println("1:新生入学\n2:查看班级信息\n3:找人\n4:在范围内查找\n9:退出");
            choice = in.nextInt();
            switch (choice) {
                case 1: {
                    System.out.print("新生姓名：");
                    String stuname = in.next();
                    jc.add(stuname);
                }
                break;
                case 2:{
                    jc.show();
                }break;
                case 3:{
                    System.out.print("找谁：");
                    String sname=in.next();
                    boolean isIn = jc.search(sname);
                    System.out.println(isIn?"在这个班":"不在");
                }break;
                case 4:{
                    System.out.print("找谁：");
                    String sname=in.next();
                    System.out.println("请输入范围起点：");
                    int start=in.nextInt();
                    System.out.println("请输入范围终点：");
                    int end=in.nextInt();
                    boolean isIn = jc.search1(start,end,sname);
                    System.out.println(isIn?"在这个班":"不在");
                }break;
                case 9:{
                    return;
                }
            }
        }
    }
}
